import axios from 'axios'
import { dbIp, updateIp} from './config.js'
import { get_cache } from "@/util/cache.js"
var ip = dbIp
var updateId = updateIp


export function addVideo (param){
    return axios({
        method: "post",
        url: ip+"/video/add",
        data: param
    });
}

export function updateVideo (param){
    return axios({
        method: "post",
        url: updateId+"/video/updateVideo",
        data: {
            "name": param.name,
            "id": param.id,
            "base64": param.base64,
            "length":param.length,
            "index": param.index,
            "token": get_cache("token")
        }
    });
}

export function mergeVideo (param){
    return axios({
        method: "get",
        url: updateId+"/video/mergeVideo",
        params: {
            id: param.id,
            token: get_cache("token"),
            type: param.type || 0
        }
    });
}

export function getTopicType (param){
    return axios({
        method: "get",
        url: ip+"/topic/getType"
    });
}